home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c
- Subject: Re: *Pointer to Functions(); /* HELP */
- Date: 22 Jan 1996 16:31:44 GMT
- Organization: Computer People Inc.
- Message-ID: <ALUN.CHAMPION.96Jan22113144@g7240065.bridge.bst.bls.com>
- References: <4dvrq8$c2c@news.unicomp.net>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: jgore@conline.com's message of 22 Jan 1996 11:18:32 GMT
-
- In article <4dvrq8$c2c@news.unicomp.net> jgore@conline.com (Jerry_Gore) writes:
-
- How do I pass a pointer to a funtion?
- ; The following is found in a program:
-
- ; #define WORD unsigned int
- ; void InstallTimer0(WORD period,void far (*func)(void));
-
- ; My function is thus:
-
- ; void far animate(void) /* I added 'far' for no good reason. */
- ; { /* It uses that name in InstallTimer0. */
- ; /* do what ever */
- ; return;
- ; }
-
- ; How do I send InstallTimer0 the pointer to my function animate ???
- ; I tried:
-
- InstallTimer0(120 , (*animate)());
-
- ; But of course, this does not work and neither did anything else!
- ; What do I do ???
-
- Try:
- InstallTimer0(120 , animate);
-
- The identifier for the function is the pointer to that function (or can be
- resolved to the pointer to that function).
-
- NB: Make sure a declaration of the animate() function happens before
- the call to InstallTimer0.
-
- Regards
-
- -A.
- --
- | A.Champion |
-